GBML manual / Motion

lands_on_solids

Whether this instance stops on solid tiles and solid objects as it moves (true), or passes through them like `gravity` and `hsp` / `vsp` alone do (false, the default). The object's "Lands on solids" box sets where it starts.

Works differently on Game Boy - Lands on solids works as on the Advance, except that an object at rest looks at what it stands on every second step, so it may start to fall a step late. One or two landing objects keep full speed; four at once make the game slower.

Works differently on Game Boy Color - Lands on solids works as on the Advance, except that an object at rest looks at what it stands on every second step: if its floor is taken away it starts to fall up to one step later.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

lands_on_solids: bool

Description

Whether this instance stops on solid tiles and solid objects as it moves, or passes through them. false is how every instance starts, unless its object's Lands on solids box is ticked. Set it in code to turn the stopping on and off while the game runs - a ghost that floats through walls until it turns solid, say.

With it on, the movement step that applies gravity, hsp and vsp does what move_slide_solid does, against the room's solid tiles and every solid object in the game:

Which objects count as solid is decided by the game, not by this instance: an object whose Solid box is ticked, or whose code sets solid. The instance never stops against itself. Solid objects that are not ticked Never moves are checked one by one every frame, and together they can hold at most 64 instances: past that the game is not built, and the message says to lower their Max instances or tick Never moves on the ones that stay put.

It stops fast things at the end of the move only. A fall faster than the instance is tall plus the thickness of the floor can jump a thin floor.

It costs nothing in a game that never uses it, and four bytes for each instance of an object that can (an object whose box is ticked, or whose code names lands_on_solids or on_ground).

Example

gravity = 0.2;
lands_on_solids = true;

Falls from where it is placed and stops on the first solid tile or obj_doc_wall below it. Tick the object's Lands on solids box and the lands_on_solids = true; line is not needed.

On the GBA

Compiled in only for objects that can use it (the object's box, or code that names `lands_on_solids` or `on_ground`): every other object, and a game with no such object, is exactly the game it was. Stopping is `move_slide_solid`'s: sideways it slides along what is open; falling it stops flush on top of the floor, setting `vsp` to 0; rising it stops flush under a ceiling, also setting `vsp` to 0.

See also: on_groundgravitymove_slide_solidsolidNever moves